/*
 * SDLFactory.cpp
 *
 *  Created on: Nov 27, 2010
 *      Author: timmeh
 */

#include "SDLFactory.h"
#include "SDLResource.h"
#include <iostream>
using namespace bo_sdl;

#define res SDLResource::Instance()

SDLFactory::SDLFactory(){
}

SDLFactory::~SDLFactory(){ }

/**
 * Creates an SDL Ball object with the supplied position, sprite and velocity
 */
SDLBall* SDLFactory::CreateBall(const char* fileName, double xPos, double yPos, double xVel, double yVel, const double scale){
	SDLBall* ball = new SDLBall;
	ball->SetPos(xPos, yPos);
	ball->SetSprite(fileName, scale);
	ball->SetDoubleVelocity(xVel, yVel);
	return ball;
}

/**
 * Creates an SDL Breakable object with the supplied position, sprite and velocity
 */
SDLBreakable* SDLFactory::CreateBreakable(const char* fileName, double xPos, double yPos, const double scale){
	SDLBreakable* breakable = new SDLBreakable;
	breakable->SetPos(xPos, yPos);
	breakable->SetSprite(fileName, scale);
	return breakable;
}

/**
 * Creates an SDL Paddle object with the supplied position, sprite and velocity
 */
SDLPaddle* SDLFactory::CreatePaddle(const char* fileName, double xPos, double yPos, const double scale, const double vel){
	SDLPaddle* pad = new SDLPaddle;
	pad->SetPos(xPos, yPos);
	pad->SetSprite(fileName, scale);
	pad->SetSingleVelocity(vel);
	return pad;
}

SDLPowerUp* SDLFactory::CreatePowerUp(const char* fileName, const double x, const double y){
	SDLPowerUp* pUp = new SDLPowerUp(0.03, fileName, res->GetScale(), x, y);
	return pUp;
}
